home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / SOURCES / WCANVAS.C < prev    next >
C/C++ Source or Header  |  1992-04-03  |  2KB  |  94 lines

  1. /*
  2.  *   MS Windows dependent Canvas code
  3.  */
  4.  
  5. #include <InterViews\itable.h>
  6. #include <Interviews\canvas.h>
  7. #include <Interviews\color.h>
  8. #include <Interviews\world.h>
  9. #include <Interviews\X11\worldrep.h>
  10. #include <string.h>
  11.  
  12. CanvasRep::CanvasRep () {
  13.     brush = GetStockObject(WHITE_BRUSH);
  14. }
  15.  
  16. CanvasRep::~CanvasRep () {
  17.     if (brush != GetStockObject(WHITE_BRUSH)) {
  18.     DeleteObject(brush);
  19.     }
  20. }
  21.  
  22. Canvas::Canvas (void* c) {
  23.     id = c;
  24.     width = 0;
  25.     height = 0;
  26.     status = CanvasUnmapped;
  27.     rep = new CanvasRep;
  28. }
  29.  
  30. Canvas::Canvas (int w, int h) {
  31.     width = w;
  32.     height = h;
  33.     status = CanvasOffscreen;
  34.     rep = new CanvasRep;
  35. }
  36.  
  37. Canvas::~Canvas () {
  38.     if (id != nil && id != (void*)GetDesktopWindow()) {
  39.     if (status == CanvasOffscreen) {
  40.     } else {
  41.         char class_name[9];
  42.         GetClassName((HWND)id, class_name, 9);
  43.         DestroyWindow((HWND)id);
  44.         if (strcmpi(class_name, "IVChild")) {
  45.          UnregisterClass(class_name, _world->hinstance());
  46.         }
  47.         _world->itable()->Remove(id);
  48.     }
  49.     id = nil;
  50.     }
  51.     delete rep;
  52. }
  53.  
  54. void* Canvas::GetBackground () {
  55.     return ((void*)rep->brush);
  56. }
  57.  
  58. void Canvas::WaitForCopy () {
  59.  }
  60.  
  61. void Canvas::SetBackground (Color* c) {
  62.     ColorIntensity r, g, b;
  63.  
  64.     c->DisplayIntensities(r, g, b);
  65.     if (rep->brush != GetStockObject(WHITE_BRUSH)) {
  66.     DeleteObject(rep->brush);
  67.     }
  68.     rep->brush = CreateSolidBrush(RGB(r, g, b));
  69. }
  70.  
  71. void Canvas::Clip (Coord, Coord, Coord, Coord) {
  72.     /* Canvas clipping unimplemented for X11. */
  73. }
  74.  
  75. void Canvas::NoClip () {
  76.     /* Canvas clipping unimplemented for X11. */
  77. }
  78.  
  79. void Canvas::ClipOn () {
  80.     /* Canvas clipping unimplemented for X11. */
  81. }
  82.  
  83. void Canvas::ClipOff () {
  84.     /* Canvas clipping unimplemented for X11. */
  85. }
  86.  
  87. boolean Canvas::IsClipped () {
  88.     return false;
  89. }
  90.  
  91. void Canvas::Map (Coord& x, Coord& y) {
  92.     /* nothing to do */
  93. }
  94.